def send_<%= api.out_name %>_request(module, client<%= input_url ? ", url" : "" %>):
<% unless input_url -%>
<%   if api.path.include?("{") -%>
    url = build_path(module, "<%= api.path -%>")
<%   else -%>
    url = <%= sprintf("\"%s\"", api.path) %>
<%   end -%>
<% end -%>

    r = None
    try:
        r = client.get(url)
    except HwcClientException as ex:
        msg = ("module(<%= module_name %>): error running "
               "api(<%= api.name %>), error: %s" % str(ex))
        module.fail_json(msg=msg)

<% if api.msg_prefix.nil? -%>
    return r
<% else -%>
<%   ai = "None" -%>
<%   unless api.msg_prefix_array_items.nil? -%>
<%     ai = "array_index" -%>
    array_index = {
<%     api.msg_prefix_array_items.each do |i| -%>
	"<%= i %>": 0,
<%     end -%>
    }
<%   end -%>
    return navigate_value(r, [<%= index2navigate(api.msg_prefix) %>], <%= ai %>)
<% end -%>
